feat: resolve project-id and org-id using instance-id#38
Draft
feat: resolve project-id and org-id using instance-id#38
project-id and org-id using instance-id#38Conversation
|
|
||
| function ensureObjectId(value: string, flagName: '--instance-id' | '--org-id' | '--project-id') { | ||
| function ensureObjectId(value: string | undefined, flagName: '--instance-id' | '--org-id' | '--project-id') { | ||
| if (value == null) { |
Collaborator
There was a problem hiding this comment.
Under what cases would value be undefined or null? It seems like we would not reach this case in the current flow.
| projectId?: string; | ||
| }; | ||
|
|
||
| function ensureObjectId(value: string | undefined, label: '--instance-id' | '--org-id' | '--project-id'): void { |
Collaborator
There was a problem hiding this comment.
Nit: It could be nice if we could export this function from the core package, instead of duplicating it here and in the cli's main.
| return { instanceConfig, linked }; | ||
| } | ||
|
|
||
| if (!orgId || !projectId) { |
Collaborator
There was a problem hiding this comment.
The logic here is becoming a bit more difficult to follow. Would it be possible to (pre)populate the orgId and projectId if only the instanceId is provided? Then, I would assume the logic of this function could remain as it was.
Otherwise, maybe lets add some code comments for the various paths.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces #37 using a cleaner and (hopefully) simpler approach.
Using a soon-to-be-introduced path in
@powersync/management-client, automatically fetch theproject_idandorg_idflags when given theinstance_idfor a number of commands (where it makes sense to do so).Example
Before:
After:
NB: Test failures are expected until the next version of the
@powersync/management-clientreleases.